import { defineStore } from "pinia";
import { ref } from "vue";
import { LocalStorageWordDao } from "../services/dao/LocalStorageWordDao";
import type { WordDao } from "../services/dao/WordDao";
import { TencentWordDao } from "../services/dao/TencentWordDao";

export const useSysStore = defineStore("sys",()=>{

    const storageEngine = ref('')

    function getWordDao():WordDao{ 
        if(storageEngine.value === 'local'){
            return new LocalStorageWordDao()
        } else if(storageEngine.value === 'cloud') {
            return new TencentWordDao()
        } else {
            throw new Error('Invalid storage engine')
        }
    }
  
    return {
        getWordDao
    }


})